<template>
  <div>
    <h1>我是语法糖的子组件</h1>
    <h1>{{ km }}</h1>
    <h1>{{ food }}</h1>
    <button @click="send">发送数据</button>
    <h1 v-li="flag">你好，明天放假</h1>
  </div>
</template>
<script lang="ts" setup>
// vue3 语法糖 注册props
import { ref, defineProps, defineExpose, defineEmits } from 'vue'
defineProps(['km', 'food'])
let hello = ref('你好，李先生')
// vue3语法糖声明要触发的父组件的自定义事件名
let emit = defineEmits(['sendli'])
let send = () => {
  emit('sendli', hello.value)
}
let flag = ref(false)
// vue3 子组件暴露数据给父组件
let cname = ref('在你头上暴扣')
defineExpose({
  cname
})
</script>
<style lang="less"></style>
